package com.haidechizi.designpattern.singleton.lazy;

/**
 * @author haidechizi
 */
public class InnerClassSingleton {

    private InnerClassSingleton() {
    }

    public static InnerClassSingleton getInstance() {
        return InnerClass.innerClassSingleton;
    }

    /**
     * 内部类只有使用的时候才会加载，通过此方式实现了懒加载
     */
    private static class InnerClass {
        private static final InnerClassSingleton innerClassSingleton = new InnerClassSingleton();
    }
}
